<?php
class anQuanController{

	function passModify(){
		include(ROOT."view/admin/tpl/pass_modify.html");
	}
	function passModifyAction(){
		$paswd = $_POST['paswd'];
		$paswd1 = $_POST['paswd1'];
		
		$message = new MessageTool();
		if($paswd!=$paswd1){
			$msg="两次输入的密码不一致，请重新输入";
			$message->prompt($msg,"./index.php?c=anQuan&a=passModify");
			exit;
		}else{
			$model = new UserModel();
			$_POST['paswd'] = md5($_POST['paswd']);
		    $data = $model->cut($_POST);

			if($model->update($data,$_SESSION['user_id'])){
				$msg = "恭喜您,修改成功！";
				$message->prompt($msg,"./index.php?c=anQuan&a=passModify");
				exit;
			}else{
				$msg = "恭喜您,修改失败！";
				$message->prompt($msg,"./index.php?c=anQuan&a=passModify");
				exit;
			}
		}
	}

	function logout(){
		session_destroy();
		$_SESSION=array();
		$msg ="退出成功";
		$message = new MessageTool();
		$message->prompt($msg,'./index.php?c=login&a=login');
		exit;
	}

}
?>